package http_server

import (
	"net/http"
)

type Handler func(ctx *Context)
type IRoutes interface {
	Get(pattern string, handler Handler)
	Post(pattern string, handler Handler)
	Put(pattern string, handler Handler)
	Delete(pattern string, handler Handler)
	Patch(pattern string, handler Handler)
	Options(pattern string, handler Handler)
	Head(pattern string, handler Handler)
	Connect(pattern string, handler Handler)
	Trace(pattern string, handler Handler)
}

func (engine *RouterGroup) POST(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodPost, pattern, handler)
}

func (engine *RouterGroup) GET(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodGet, pattern, handler)
}

func (engine *RouterGroup) PUT(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodPut, pattern, handler)
}

func (engine *RouterGroup) DELETE(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodDelete, pattern, handler)
}

func (engine *RouterGroup) PATCH(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodPatch, pattern, handler)
}

func (engine *RouterGroup) OPTIONS(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodOptions, pattern, handler)
}

func (engine *RouterGroup) HEAD(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodHead, pattern, handler)
}

func (engine *RouterGroup) CONNECT(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodConnect, pattern, handler)
}

func (engine *RouterGroup) TRACE(pattern string, handler HandlerFunc) {
	engine.addRoute(http.MethodTrace, pattern, handler)
}
